<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>后台管理系统-商品管理</title>
    <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="assets/bootstrap-validator/css/bootstrapValidator.min.css"/>
    <link rel="stylesheet" href="assets/nprogress/nprogress.css"/>
    <link rel="stylesheet" href="css/admin.css"/>
    <style>
        .fileupload{
            position: relative;
        }
        .fileupload [type="file"]{
            width: 82px;
            height: 34px;
            position: absolute;
            opacity: 0;
        }
    </style>
</head>
<body>
<!--侧边栏-->
<aside class="ad_aside">
    <!--商标-->
    <div class="brand"><a href="index.html">ITCAST</a></div>
    <!--用户-->
    <div class="user">
        <img src="images/default.png" alt=""/>
        <span>超级管理员</span>
    </div>
    <!--菜单-->
    <div class="menu">
        <ul>
            <li><a href="userManage.html"><span class="glyphicon glyphicon-user"></span> 用户管理</a></li>
            <li>
                <a href="javascript:;"><span class="glyphicon glyphicon-list"></span> 分类管理</a>
                <div class="child">
                    <a href="categoryFirst.html">一级分类</a>
                    <a href="categorySecond.html">二级分类</a>
                </div>
            </li>
            <li class="now"><a href="productManage.html"><span class="glyphicon glyphicon-tags"></span> 商品管理</a></li>
        </ul>
    </div>
</aside>
<!--内容-->
<section class="ad_section">
    <!--顶部导航-->
    <nav class="ad_nav">
        <a data-menu href="javascript:;"><span class="glyphicon glyphicon-align-justify"></span></a>
        <a data-logout href="javascript:;"><span class="glyphicon glyphicon-log-out"></span></a>
    </nav>
    <div class="container-fluid">
        <!--路径导航-->
        <ol class="breadcrumb">
            <li><a href="#">管理系统</a></li>
            <li class="active">商品管理</li>
        </ol>
        <div class="ad_content">
            <button id="addBtn" class="btn btn-default mb_15">添加商品</button>
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th width="5%">序号</th>
                    <th width="25%">商品名称</th>
                    <th width="25%">商品描述</th>
                    <th width="10%">商品库存</th>
                    <th width="10%">商品尺寸</th>
                    <th width="10%">商品状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                    <!--todo-->
                </tbody>
            </table>
            <div class="page">
                <ul class="pagination"></ul>
            </div>
        </div>
    </div>
</section>
<!--模态框-->
<div class="modal fade addProduct">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" ><span >&times;</span></button>
                <h4 class="modal-title">添加商品</h4>
            </div>
            <div class="modal-body">
                <form id="form" action="#" autocomplete="off">
                    <div class="form-group">
                        <select name="brandId" id="secondBox" class="form-control">
                            <!--todo-->
                        </select>
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入商品名称" name="proName">
                    </div>
                    <div class="form-group">
                        <textarea name="proDesc" cols="76" rows="10" style="resize: none" placeholder="请输入商品描述" width="100%"></textarea>
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入商品库存" name="num">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入商品价格" name="price">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入商品原价" name="oldPrice">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="请输入商品尺码" name="size">
                    </div>
                    <!--商品的图片-->
                    <div class="form-group">
                        <input type="hidden" name="pic">
                        <div class="fileupload">
                            <input type="file" name="pic1" data-url="/product/addProductPic" class="btn btn-default" multiple>
                            <a href="javascript:;" class="btn btn-default">上传图片</a>
                            <span>提示：必须上传三个图片</span>
                        </div>
                    </div>
                    <div class="form-group"></div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="submit" class="btn btn-primary" form="form">保存</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade editProduct">
    <div class="modal-dialog modal-md">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" ><span >&times;</span></button>
                <h4 class="modal-title">添加商品</h4>
            </div>
            <div class="modal-body">
                <form id="form1" action="#" autocomplete="off" class="editForm">
                    <!--todo-->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="submit" class="btn btn-primary" form="form1">保存</button>
            </div>
        </div>
    </div>
</div>
<script type="text/template" id="editProducts">

    <div class="form-group">
        <select name="brandId" id="secondBox1" class="form-control">
            <!--todo-->
        </select>
    </div>
    <div class="form-group">
        <input type="text" class="form-control" value="<%=detail.proName%>" name="proName">
    </div>
    <div class="form-group">
        <textarea name="proDesc" cols="76" rows="10" style="resize: none"  width="100%"></textarea>
    </div>
    <div class="form-group">
        <input type="text" class="form-control" value="<%=detail.num%>" name="num">
    </div>
    <div class="form-group">
        <input type="text" class="form-control" value="<%=detail.price%>" name="price">
    </div>
    <div class="form-group">
        <input type="text" class="form-control" value="<%=detail.oldPrice%>" name="oldPrice">
    </div>
    <div class="form-group">
        <input type="text" class="form-control" value="<%=detail.size%>" name="size">
    </div>
    <!--商品的图片-->
    <div class="form-group">
        <input type="hidden" name="pic">
        <div class="fileupload">
            <input type="file" name="pic1" data-url="/product/addProductPic" class="btn btn-default" multiple>
            <a href="javascript:;" class="btn btn-default">上传图片</a>
            <span>提示：必须上传三个图片</span>
        </div>
    </div>
    <div class="form-group"></div>

</script>
<script type="text/template" id="select">
    <option value="0">请选择一级分类名称</option>
    <%for(var i = 0; i < rows.length; i++) { %>
        <option value="<%=rows[i].id%>"><%=rows[i].categoryName%></option>
    <% } %>

</script>
<script type="text/template" id="template">
    <%for(var i = 0; i < rows.length; i++ ) { %>
    <tr data-id="<%=rows[i].id%>">
        <td><%=(page-1)*size+1+i%></td>
        <td><%=rows[i].proName%></td>
        <td><%=rows[i].proDesc%></td>
        <td><%=rows[i].num%></td>
        <td><%=rows[i].size%></td>
        <td><%=rows[i].statu == 1?'已上架':'已下架'%></td>
        <td>
        <%if(rows[i].statu == 1) {%>
            <a class="btn btn-sm btn-danger jia" href="javascript:;" data-id="<%=rows[i].id%>">下架</a>
        <% } else { %>
            <a class="btn btn-sm btn-success jia" href="javascript:;" data-id="<%=rows[i].id%>">上架</a>
        <% } %>
            <a href="javascript:;" class="btn btn-sm btn-primary edit" data-id="<%=rows[i].id%>">编辑</a>
        </td>
    </tr>
    <% } %>
</script>
<script src="assets/jquery/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/bootstrap-validator/js/bootstrapValidator.min.js"></script>
<script src="assets/nprogress/nprogress.js"></script>
<script src="assets/artTemplate/template-native.js"></script>
<script src="assets/bootstrap-paginator/bootstrap-paginator.min.js"></script>
<script src="assets/jquery-fileupload/jquery.ui.widget.js"></script>
<script src="assets/jquery-fileupload/jquery.fileupload.js"></script>
<script src="js/admin.js"></script>
<script src="js/productMange.js"></script>
</body>
</html>